!define /date CUR_TIME "%H:%M:%S %d %b, %Y"

!macro customInstall
   ;所有文件和文件夹
   WriteRegStr HKCR "AllFilesystemObjects\shell\gagamengprinter" "" "添加到打印列表"
   WriteRegStr HKCR "AllFilesystemObjects\shell\gagamengprinter" "Icon" "$INSTDIR\gagamengprinter.exe"
   WriteRegStr HKCR "AllFilesystemObjects\shell\gagamengprinter\command" "" '"$INSTDIR\gagamengprinter.exe" "addItems" "%1"'

   ;文件夹空白处
   WriteRegStr HKCR "Directory\Background\shell\gagamengprinter" "" "添加到打印列表"
   WriteRegStr HKCR "Directory\Background\shell\gagamengprinter" "Icon" "$INSTDIR\gagamengprinter.exe"
   WriteRegStr HKCR "Directory\Background\shell\gagamengprinter\command" "" '"$INSTDIR\gagamengprinter.exe" "addItems" "%V"'

    ;获取安装时的时间
    !insertmacro GetTime
    ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6

    ;将当前时间写入文件
    FileOpen $7 "$INSTDIR\resources\app.asar.unpacked\resources\install.txt" w
    FileWrite $7 "$2-$1-$0 $4:$5:$6"
    FileClose $7

!macroend
!macro customUninstall
   DeleteRegKey HKCR "AllFilesystemObjects\shell\gagamengprinter"
   DeleteRegKey HKCR "Directory\Background\shell\gagamengprinter"
!macroend